package com.company.nuwa.redis.support.lock;

import com.company.nuwa.common.exception.BizException;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * <p>default lock failure strategy</p >
 *
 * @author youyoukele
 * @version 1.0
 * @date 2021/12/20
 */
@Slf4j
public class DefaultLockFailureStrategy implements LockFailureStrategy {

    @Override
    public void onLockFailure(String lockKey, int waitTime, TimeUnit unit) {
        log.error("request lock key:{} wait time:{} {}", lockKey, waitTime, unit);
        throw new BizException(-1, "redis lock key time out");
    }
}
